module.exports = app => {
    const { STRING, INTEGER, DATE, TEXT } = app.Sequelize;
  
    const Article = app.model.define('article', {
      id: {
        type: INTEGER,
        primaryKey: true,
        allowNull: false,
        autoIncrement: true,
      },
      title: {
        type: STRING(255),
        allowNull: false,
      },
      poster: {
        type: STRING,
        allowNull: true,
      },
      detail: {
        type: TEXT('long'), // 'long'表示LONGTEXT，适用于存储大量文本
        allowNull: false,
      },
      classify: {
        type: STRING,
        allowNull: true,
      },
      publishTime: {
        type: DATE || Null,
        allowNull: true,
      }
    }, {
        timestamps: true,
        underscored: false,
    });
  
    return Article;
  };
  